﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadFiles.aspx.cs" Inherits="NetFlow.UploadFiles" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>文件上传与转换</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
    <style>
        body {
            background-color: #f8f9fa;
        }
        .container {
            max-width: 800px;
            margin-top: 30px;
            background: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        .btn-sm {
            margin: 2px;
        }
        .table th, .table td {
            text-align: center;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div class="container">
            <h2 class="text-center mb-4">文件上传与转换</h2>
            
            <div class="mb-3">
                <label class="form-label fw-bold">请选择上传文件：</label>
                <asp:FileUpload ID="FileUpload1" runat="server" CssClass="form-control" />
            </div>
            
            <div class="text-center">
                <asp:Button ID="Button1" runat="server" Text="上传文件" CssClass="btn btn-primary" OnClick="Button1_Click" />
            </div>

            <asp:Label ID="Label1" runat="server" CssClass="text-danger mt-3 d-block"></asp:Label>

            <div class="mt-4">
                <h4 class="text-center">已上传文件列表</h4>
                <asp:GridView ID="GridView1" runat="server" CssClass="table table-bordered table-striped mt-3" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand" OnRowDeleting="GridView1_RowDeleting1">
                    <Columns>
                        <asp:BoundField DataField="FileName" HeaderText="文件名" />
                        <asp:BoundField DataField="FilePath" HeaderText="文件路径" />
                        <asp:TemplateField HeaderText="操作">
                            <ItemTemplate>
                                <%--<asp:Button ID="btnConvertCSV" runat="server" Text="CSV" CssClass="btn btn-success btn-sm" CommandName="ConvertCSV" CommandArgument='<%# Eval("FilePath") %>' />--%>
                                <%--<asp:Button ID="btnConvertTXT" runat="server" Text="TXT" CssClass="btn btn-info btn-sm" CommandName="ConvertTXT" CommandArgument='<%# Eval("FilePath") %>' />--%>
                                <%--<asp:Button ID="btnConvertXLSX" runat="server" Text="XLSX" CssClass="btn btn-warning btn-sm" CommandName="ConvertXLSX" CommandArgument='<%# Eval("FilePath") %>' />--%>
                                <asp:Button ID="btnAnalyze" runat="server" Text="分析" CssClass="btn btn-primary btn-sm" CommandName="Analyze" CommandArgument='<%# Eval("FilePath") %>' />
                                <asp:Button ID="btnDelete" runat="server" Text="删除" CssClass="btn btn-danger btn-sm" CommandName="Delete" CommandArgument='<%# Eval("FilePath") %>' OnClientClick="return confirm('确定要删除这个文件吗？');"/>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>
    </form>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
